<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
        body {
            margin: 0px;           
        }
        
        .bar{
        	background-image:url(images/menuImg.jpg);        	
            background-size:25% 60px;
            background-repeat:repeat-x;            
        }
        
        .shadow{
        	-moz-box-shadow:2px 2px 5px #333333;
        	-webkit-box-shadow:2px 2px 5px #333333;
        	box-shadow:2px 2px 5px #333333;
        }
        
        .menu{
        	margin: 3px 5px 5px 5px;
        }
        
        .userInfo-left{
        	margin: 3px 5px 5px 5px;
        	width: 50px;
        	float: left;
        }
        
        .userInfo-right{
        	margin: 3px 5px 5px 5px;
        	height: 50px;
        	float: left;
        }
        
    </style>
</head>
<body class="bar">
	<div align="left" style="width: 50%; float: left;">
		<c:choose>
			<c:when test="${curUser != null}">
				<div class="userInfo-left"><img id="headImg" src="<%=basePath%>/images/headImages/${curUser.headImg}" width="100%" height="50px"></div>
			</c:when>
			<c:otherwise>
				<div class="userInfo-left"><img id="headImg" src="images/head.png" width="100%" height="50px"></div>
			</c:otherwise>
		</c:choose>
		<div class="userInfo-right">	
			<c:choose>
				<c:when test="${curUser != null}">
					<a style="font-size: 20px; font-weight: 700; color: #FFFF00;">${curUser.userName}</a><br>
					<div style="width: 250px;text-align: center; border-radius: 5px; background-color: #0A7FCE">
						<a style="color: white; font-size: 12px;">经验：${curUser.experience}</a>&nbsp;&nbsp;
						<a style="color: yellow; font-size: 12px;">金币：${curUser.money}</a>&nbsp;&nbsp;
						<a style="color: #FF7F00; font-size: 12px">积分：${curUser.point}</a>
					</div>
				</c:when>
				<c:otherwise>
					<a style="font-size: 20px; font-weight: 700; color: #FFFF00;">未登录</a><br>
					<div style="width: 250px;text-align: center; border-radius: 5px; background-color: #0A7FCE">
						<a style="color: white; font-size: 12px;">经验：0</a>&nbsp;&nbsp;
						<a style="color: yellow; font-size: 12px;">金币：0</a>&nbsp;&nbsp;
						<a style="color: #FF7F00; font-size: 12px">积分：0</a>
					</div>
				</c:otherwise>
			</c:choose>
		</div>
	</div>
	<div align="right" style="width: 50%; float: left;">
		<a id="game" target="workspace"><img class="menu shadow" src="images/farmLogo.png" width="50px"></a>
		<a href="<%=basePath%>/user/seedBag" target="workspace"><img class="menu shadow" src="images/shop.png" width="50px"></a>
		<a href="<%=basePath%>/user/userLogin" target="workspace"><img class="menu shadow" src="images/farmer.png" width="50px"></a>
		<a href="<%=basePath%>/user/grid" target="workspace"><img class="menu shadow" src="images/user.png" width="50px"></a>
		<a href="<%=basePath%>/seed/grid" target="workspace"><img class="menu shadow" src="images/seedManager.png" width="50px"></a>
	</div>
	<script type="text/javascript">
		var game = document.getElementById("game");
		var curUser = "${curUser}";
		console.log("curUser ============");
		console.log(curUser);
		if(curUser != ""){
			console.log("curUser不为空！！");
			game.href = "<%=basePath%>/farm/game";
		}else{
			console.log("curUser为空！！");
			game.href = "<%=basePath%>/user/userLogin";
		}
	</script>
</body>
</html>




